<template>
  <!-- 组卷策略 -->
  <div class="app-container">
    <!-- 查询 -->
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" >

      <el-form-item label="科目:" prop="subjectId">
          <el-select v-model="queryParams.subjectId" placeholder="请选择科目" clearable size="small" >
              <el-option
              v-for="dict in kelist"
              :key="dict.id"
              :label="dict.name"
              :value="dict.id"
              />
          </el-select>
      </el-form-item>
      <el-form-item label="策略名称:" prop="name">
          <el-input
          v-model="queryParams.name"
          placeholder="请输入策略名称"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
          />
      </el-form-item>
      <!-- <el-form-item label="使用单位:" prop="useNearest">
          <el-input
          v-model="queryParams.useNearest"
          placeholder="请输入使用单位"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
          />
      </el-form-item> -->
      <!-- <el-form-item label="地市:" prop="area">
          <el-select v-model="queryParams.area" placeholder="请选择地市" clearable size="small" >
              <el-option
              v-for="dict in arealist"
              :key="dict.id"
              :label="dict.name"
              :value="dict.id"
              />
          </el-select>
      </el-form-item> -->
      <el-form-item>
        <el-button
          type="primary"
          icon="el-icon-search"
          size="mini"
          @click="handleQuery"
          >搜索</el-button
        >
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
          >重置</el-button
        >
      </el-form-item>
    </el-form>
    <!-- 新增修改 -->
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['system:info:add']"
          >新增</el-button
        >
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" ></right-toolbar>
    </el-row>
    <!-- 组卷策略表 -->
    <el-table
      v-loading="loading"
      :data="infoList"
      @selection-change="handleSelectionChange"
      :row-class-name="tableRowClassName"
    >
      <el-table-column label="序号" type="index" width="70" :index="indexMetthod" align="center" >
      </el-table-column>
      <el-table-column label="科目" align="center" prop="subject" />
      <el-table-column label="策略名称" align="center" prop="name" />
      <el-table-column label="策略编码" align="center" prop="clbm" />
      <el-table-column label="试卷总题数" align="center" prop="totalQuestions" />
      <el-table-column label="总分" align="center" prop="totalScore" />
      <el-table-column label="试卷难易度" align="center" prop="difficultyDegree" />
      <!-- <el-table-column label="试卷难易度" align="center" prop="difficultyDegree" >
          <template slot-scope="scope">
          <span v-if="scope.row.difficultyDegree == 1">0</span>
          <span v-else-if="scope.row.difficultyDegree == 2">0.1</span>
          <span v-else-if="scope.row.difficultyDegree == 3">0.2</span>
          <span v-else-if="scope.row.difficultyDegree == 4">0.3</span>
          <span v-else-if="scope.row.difficultyDegree == 5">0.4</span>
          <span v-else-if="scope.row.difficultyDegree == 6">0.5</span>
          <span v-else-if="scope.row.difficultyDegree == 7">0.6</span>
          <span v-else-if="scope.row.difficultyDegree == 8">0.7</span>
          <span v-else-if="scope.row.difficultyDegree == 9">0.8</span>
          <span v-else-if="scope.row.difficultyDegree == 10">0.9</span>
          <span v-else-if="scope.row.difficultyDegree == 11">0.10</span>
          <span v-else>暂无状态</span>
        </template>
      </el-table-column> -->
      <el-table-column label="地市" align="center" prop="area" />
      <!-- <el-table-column label="使用单位" align="center" prop="useNearest" />
      <el-table-column label="最近使用时间" align="center" prop="useTimeNearest" width="150" /> -->
      <el-table-column label="备注" align="center" prop="remark" />

      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="300" >
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['system:info:edit']"
            >修改</el-button
          >
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['system:info:remove']"
            >删除</el-button
          >
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页器 -->
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改组卷策信息对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="100px">
        <!-- 科目策略名称 -->
        <el-row>
          <el-col :span="12">
            <el-form-item label="科目" prop="subjectId" >
                <el-select v-model="form.subjectId" placeholder="请选择" ref="gain" @change="kechange" >
                    <el-option
                    v-for="item in kelist"
                    :key="item.id"
                    :label="item.name"
                    :value="item.id"
                    />
                </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="策略名称" prop="name">
              <el-input
                v-model.trim="form.name"
                placeholder="请输入策略名称"
                maxlength="90"
                style="width:218px;"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <!-- 策略编码试题总数 -->
        <el-row>
          <el-col :span="12">
            <el-form-item label="策略编码" prop="clbm">
              <el-input
                v-model.trim="form.clbm"
                placeholder="请输入策略编码"
                maxlength="80"
                style="width:218px;"
              />
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="试卷总题数" prop="totalQuestions">
              <el-input
                @input="totalQuestionschange"
                v-model.trim="form.totalQuestions"
                placeholder="请输入试卷总题数"
                maxlength="10"
                style="width:218px;"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <!-- 总分地市 -->
        <el-row>
          <el-col :span="12">
             <el-form-item label="试卷总分" prop="totalScore">
              <el-input
                v-model.trim="form.totalScore"
                placeholder="请输入试卷总题数"
                maxlength="10"
                style="width:218px;"
              />
            </el-form-item>
          </el-col>

          <el-col :span="7">
            <el-form-item label="所属地市" prop="shi" >
            <el-select v-model="form.shi" placeholder="请选择省份" style="width:150px;" @change="changearea" >
                <el-option 
                v-for="item in arealist"
                :key="item.id"
                :label="item.name"
                :value="item.id"
                />
            </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="1">
            <el-select v-model="form.belongArea" placeholder="请选择市区" style="width:120px;"  >
                <el-option 
                v-for="item in qulist"
                :key="item.id"
                :label="item.name"
                :value="item.id"
                />
            </el-select>
          </el-col>
        </el-row>
        <!-- 备注 -->
        <el-row>
          <el-col :span="22">
            <el-form-item label="备注" prop="remark">
              <el-input
                v-model="form.remark"
                type="textarea"
                placeholder="请输入内容"
                maxlength="200"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        
        <el-form-item label="题型比例" />
        <!-- 题型数量分数 -->
        <el-table :data="form.rtAssemblyConfs" :row-class-name="tableRowClassName"  style="width: 800px; margin:auto;" size="mini">
          <el-table-column label="题型/模块"  align="center">
            <template slot-scope="scope" >
                <span> {{scope.row.questionType}} </span>
            </template>
          </el-table-column>

          <el-table-column label="题数" align="center">
            <template slot-scope="scope" >
                <el-input v-model="scope.row.count" style="width:80px;" size="small" :maxlength="30" @input="countchange" oninput="value=value.replace(/^(0+)|[^\d]+/g,'')"></el-input>
            </template>
          </el-table-column>

          <el-table-column label="单题分值" align="center">
            <template slot-scope="scope" >
                <el-input v-model="scope.row.singleScore" style="width:80px;" size="small" :maxlength="30" @input="singleScorechange"></el-input>
            </template>
          </el-table-column>

          <el-table-column label="占比" align="center">
            <template slot-scope="scope" >
                <span v-if=" form.totalQuestions == '' || form.totalQuestions == null ">
                  0%
                </span>
                <!-- <span v-else> {{scope.row.proportion}}% </span> -->
                <span v-else> {{Math.floor((scope.row.count / form.totalQuestions)*10000)/100}}% </span>
            </template>
          </el-table-column>

          <el-table-column label="总分值" align="center">
            <template slot-scope="scope" >
                <span> {{scope.row.totalScore}} </span>
            </template>
          </el-table-column>
          
        </el-table>
        <!-- 合计题型数量 -->
        <el-table :data="asseform" :row-class-name="tableRowClassName"  style="width: 800px; margin:auto;" size="mini" :show-header="false" >

          <el-table-column align="center"  prop="name" />

          <el-table-column align="center"  prop="num" >
            <template slot-scope="scope" >
                <span>{{scope.row.num}}</span>
            </template>
          </el-table-column>

          <el-table-column align="center"  prop="scorenum" >
            <template slot-scope="scope" >
                <span>{{scope.row.scorenum}}</span>
            </template>
          </el-table-column>

          <el-table-column align="center"  prop="ratio" >
            <template slot-scope="scope" >
                <span> {{scope.row.ratio}}% </span>
            </template>
          </el-table-column>

           <el-table-column align="center"  prop="scoreratio" >
            <template slot-scope="scope" >
                <span> {{scope.row.scoreratio}}</span>
            </template>
          </el-table-column>

        </el-table>
        <el-form-item label="知识点" />
        <!-- 知识点数据 -->
        <el-table :data="form.rtAssemblyKnowledges" :row-class-name="tableRowClassName"  style="width: 800px; margin:auto;" size="mini">
          <el-table-column label="知识点"  align="center">
            <template slot-scope="scope" >
                <span> {{scope.row.name}} </span>
            </template>
          </el-table-column>

          <el-table-column label="掌握" align="center">
            <template slot-scope="scope" >
                <span> {{scope.row.importance}} </span>
            </template>
          </el-table-column>

          <el-table-column label="比例" align="center">
            <template slot-scope="scope">
                <span v-if=" form.totalQuestions == '' || form.totalQuestions == null ">
                  0%
                </span>
                <span v-else> {{Math.floor((scope.row.count / form.totalQuestions)*10000)/100}}% </span>
            </template>
          </el-table-column>

          <el-table-column label="题数" align="center">
            <template slot-scope="scope" >
                <el-input v-model="scope.row.count" style="width:80px;" size="small" :maxlength="30" @input="Knowledgeschange" oninput="value=value.replace(/^(0+)|[^\d]+/g,'')"></el-input>
            </template>
          </el-table-column>
        </el-table>
        <!-- 计算知识点合计 -->
         <el-table :data="Knowledgesform" :row-class-name="tableRowClassName"  style="width: 800px; margin:auto;" size="mini" :show-header="false" >

          <el-table-column align="center"  prop="name" />
          <el-table-column align="center"  />

          <el-table-column align="center"  prop="ratio" >
            <template slot-scope="scope" >
                <span> {{scope.row.ratio}}% </span>
            </template>
          </el-table-column>

           <el-table-column align="center"  prop="scoreratio" >
            <template slot-scope="scope" >
                <span> {{scope.row.num}}</span>
            </template>
          </el-table-column>

        </el-table>
        <!-- 难易度及数量 -->
        <el-table :data="form.rtAssemblyDifficulties" :row-class-name="tableRowClassName"  style="width: 800px; margin:auto;" size="mini">
          <el-table-column label="难易度" min-width="200" align="center">
            <template slot-scope="scope" >
                <span v-if="scope.row.difficulty == 1">0</span>
                <span v-if="scope.row.difficulty == 2">0.1</span>
                <span v-if="scope.row.difficulty == 3">0.2</span>
                <span v-if="scope.row.difficulty == 4">0.3</span>
                <span v-if="scope.row.difficulty == 5">0.4</span>
                <span v-if="scope.row.difficulty == 6">0.5</span>
                <span v-if="scope.row.difficulty == 7">0.6</span>
                <span v-if="scope.row.difficulty == 8">0.7</span>
                <span v-if="scope.row.difficulty == 9">0.8</span>
                <span v-if="scope.row.difficulty == 10">0.9</span>
                <span v-if="scope.row.difficulty == 11">1.0</span>
            </template>
          </el-table-column>

          <el-table-column label="试题数量" min-width="200" align="center">
            <template slot-scope="scope" >
              <!-- <el-form-item style="text-align: center;" :prop="'rtAssemblyDifficulties.' + scope.$index + '.count'" :rules='addrules.count'> -->
                  <el-input style="width:80px;" v-model="scope.row.count" size="small" :maxlength="30"  @input="inputchange" oninput="value=value.replace(/^(0+)|[^\d]+/g,'')"></el-input>
              <!-- </el-form-item> -->
            </template>
          </el-table-column>

          <el-table-column label="比例" min-width="200" align="center">
            <template slot-scope="scope" >
                <span v-if="form.totalQuestions == null || form.totalQuestions == ''">0%</span>
                <span v-else>{{Math.floor((scope.row.count / form.totalQuestions)*10000)/100}}%</span>
            </template>
          </el-table-column>
        </el-table>
        <!-- 合计难易度 -->
        <el-table :data="dataform" :row-class-name="tableRowClassName"  style="width: 800px; margin:auto;" size="mini" :show-header="false" >

          <el-table-column  min-width="200" align="center"  prop="name" />

          <el-table-column  min-width="200" align="center"  prop="num" >
            <template slot-scope="scope" >
                <span>{{scope.row.num}}</span>
            </template>
          </el-table-column>

          <el-table-column  min-width="200" align="center"  prop="ratio" >
            <template slot-scope="scope" >
                <!-- <span v-if="form.totalQuestions == null || form.totalQuestions == ''">0%</span>
                <span v-else>{{Math.floor((scope.row.num / form.totalQuestions)*10000)/100 }}%</span> -->
                <span> {{scope.row.ratio}}% </span>
            </template>
          </el-table-column>

        </el-table>
        <!--  难易度等级   计算 -->
        <el-row>
          <el-col>
            <el-form-item label="试卷预估难易度系数"  label-width="220px">
              <template slot-scope="scope"  >
                <span v-if="form.totalQuestions == null || form.totalQuestions == ''">0</span>
                <span v-else>{{form.difficultyDegree}}</span>
                <!-- <span v-if="form.difficultyDegree > 0 && form.difficultyDegree<=1"> 易（0.00 - 1.00）</span>
                <span v-else-if="form.difficultyDegree > 1 && form.difficultyDegree<=2"> 较易（1.01 - 2.00）</span>
                <span v-else-if="form.difficultyDegree > 2 && form.difficultyDegree<=3"> 中（2.01 - 3.00）</span>
                <span v-else-if="form.difficultyDegree > 3 && form.difficultyDegree<=4"> 较难（3.01 - 4.00）</span>
                <span v-else-if="form.difficultyDegree > 4 && form.difficultyDegree<=5"> 难（4.01 - 5.00）</span> -->
                <div> {{scope.row}} </div>
              </template>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listInfo, getInfo, delInfo, addInfo, updateInfo, listType,areainfo, infoList,moduleinfo, areasinfo, } from "@/api/system/assembly";

export default {
  name: "type",
  data() {
    return {
      // 合计难易度
      dataform:[
        {
          name:"合计",
          num:0,
          ratio:0
        }
      ],
      // 合计题型比例
      asseform:[
        {
          name:"合计",
          num:0,
          ratio:0,
          scorenum:null,
          scoreratio:0,
        }
      ],
      // 判断题型有没有莫模块
      moduleshow:false,
      // 合计知识点
      Knowledgesform:[
        {
          name:"合计",
          num:0,
          ratio:0,
        }
      ],
      status: [
        {
          id: 1,
          name: "启用",
        },
        {
          id: 0,
          name: "禁用",
        },
      ],
      // 科目下拉列表 加搜索
      kelist:[],
      inidlist:{
        subjectId:null
      },
      // 地市
      fordishi:{
          pid:0,
      },
      //地市下拉
      arealist:[],
      //区市下拉
      qulist:[],
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 科目信息表格数据
      infoList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        subjectId: null,
        name: null,
        useNearest: null,
        // area: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        code: [
          { required: true, message: "考试编码不能为空", trigger: "blur" },
        ],
        name: [
          { required: true, message: "考试名称不能为空", trigger: "blur" },
        ],
        subjectId: [
          { required: true, message: "科目不能为空", trigger: "change" }
        ],
        clbm: [
          { required: true, message: "策略编码不能为空", trigger: "blur" },
        ],
        totalQuestions: [
          { required: true, message: "试题总数不能为空", trigger: "blur" },
        ],
        totalScore: [
          { required: true, message: "试卷总分不能为空", trigger: "blur" },
        ],
      },
      addrules:{
        count:[
          { required: true, message: '请输入试题数量', trigger: 'blur'}
        ]
      },
      // 难度固定选项
      xiuDifficult:[
          {
            difficulty:1,
            diffname:"易",
            proportion:0,
            count:null,
          },
          {
            difficulty:2,
            diffname:"易较",
            proportion:0,
            count:null,
          },
          {
            difficulty:3,
            diffname:"较易",
            proportion:0,
            count:null,
          },
          {
            difficulty:4,
            diffname:"较易",
            proportion:0,
            count:null,
          },
          {
            difficulty:5,
            diffname:"中",
            proportion:0,
            count:null,
          },
          {
            difficulty:6,
            diffname:"中",
            proportion:0,
            count:null,
          },
          {
            difficulty:7,
            diffname:"较难",
            proportion:0,
            count:null,
          },
          {
            difficulty:8,
            diffname:"较难",
            proportion:0,
            count:null,
          },
          {
            difficulty:9,
            diffname:"难",
            proportion:0,
            count:null,
          },
          {
            difficulty:10,
            diffname:"难",
            proportion:0,
            count:null,
          },
          {
            difficulty:11,
            diffname:"难",
            proportion:0,
            count:null,
          },
      ],
      // 题型固定选项
      xiuConfs:[
          {
            questionType:"单选题",
            // 题数
            count:null,
            // 比例
            proportion:0,
            //题型id
            questionTypeId:1,
            // questionTypeModuleId:1,
            singleScore:null,
            totalScore:0,
          },
          {
            questionType:"多选题",
            // 题数
            count:null,
            // 占比
            proportion:0,
            //题型id
            questionTypeId:2,
            // questionTypeModuleId:1,
            // 单题分值
            singleScore:null,
            //总分值
            totalScore:0,
          },
          {
            questionType:"判断题",
            // 题数
            count:null,
            // 占比
            proportion:0,
            //题型id
            questionTypeId:4,
            // questionTypeModuleId:1,
            // 单题分值
            singleScore:null,
            //总分值
            totalScore:0,
          },
          {
            questionType:"案例题",
            // 题数
            count:null,
            // 占比
            proportion:0,
            //题型id
            questionTypeId:5,
            // questionTypeModuleId:1,
            // 单题分值
            singleScore:null,
            //总分值
            totalScore:0,
          },
          {
            questionType:"简答题",
            // 题数
            count:null,
            // 占比
            proportion:0,
            //题型id
            questionTypeId:6,
            // questionTypeModuleId:1,
            // 单题分值
            singleScore:null,
            //总分值
            totalScore:0,
          },
          
      ],
    };
  },
  created() {
    this.getList();
    this.xialaList()
        console.log(this.kelist,'...........')

    //地市下拉
      this.areaget()
  },
  methods: {
    // 隔行效果
    tableRowClassName({ row, rowIndex }) {
      if ((rowIndex + 1) % 2 === 0) {
        return "warning-row";
      } else {
        return "success-row";
      }
    },
    // 序号
    indexMetthod: function (index) {
      return (
        (this.queryParams.pageNum - 1) * this.queryParams.pageSize + index + 1
      );
    },
    kechange(){
      // 再次请求时情况知识点列表
      this.form.rtAssemblyKnowledges = []
      this.inidlist.subjectId = this.form.subjectId
      // 请求知识点信息
      infoList(this.inidlist,this.inidlist.subjectId,this.inidlist.type=3).then(response => {
        this.zhilist = response.rows;
        this.loading = false;
        for(let i=0;i<this.zhilist.length;i++){
          this.zhilist[i].count=''
          this.zhilist[i].knowledgeId=this.zhilist[i].id
        }
        this.form.rtAssemblyKnowledges = this.zhilist
      });
      // moduleinfo(this.inidlist,this.inidlist.subjectId).then(response => {
      //   this. modulelist = response.rows;
      //   this.loading = false;
      //   if(this.modulelist.length>1){
      //     //判断有模块
      //     this.moduleshow = true
      //     this.form.rtAssemblyConfs = []
      //     for(let i=0;i<this.modulelist.length;i++){
      //       this.modulelist[i].singleScore = null
      //       this.modulelist[i].count = null
      //     }
      //     this.form.rtAssemblyConfs = this.modulelist
      //   }else{
      //     //判断没有模块
      //     this.moduleshow = false
      //     let rtAssemblyConfs=[
      //       {
      //         questionType:"单选题",
      //         // 题数
      //         count:null,
      //         // 比例
      //         proportion:0,
      //         //题型id
      //         questionTypeId:1,
      //         questionTypeModuleId:1,
      //         singleScore:null,
      //         totalScore:0,
      //       },
      //       {
      //         questionType:"多选题",
      //         // 题数
      //         count:null,
      //         // 占比
      //         proportion:0,
      //         //题型id
      //         questionTypeId:2,
      //         questionTypeModuleId:1,
      //         // 单题分值
      //         singleScore:null,
      //         //总分值
      //         totalScore:0,
      //       },
      //       {
      //         questionType:"判断题",
      //         // 题数
      //         count:null,
      //         // 占比
      //         proportion:0,
      //         //题型id
      //         questionTypeId:4,
      //         questionTypeModuleId:1,
      //         // 单题分值
      //         singleScore:null,
      //         //总分值
      //         totalScore:0,
      //       },
      //       {
      //         questionType:"案例题",
      //         // 题数
      //         count:null,
      //         // 占比
      //         proportion:0,
      //         //题型id
      //         questionTypeId:5,
      //         questionTypeModuleId:1,
      //         // 单题分值
      //         singleScore:null,
      //         //总分值
      //         totalScore:0,
      //       },
      //       {
      //         questionType:"简答题",
      //         // 题数
      //         count:null,
      //         // 占比
      //         proportion:0,
      //         //题型id
      //         questionTypeId:6,
      //         questionTypeModuleId:1,
      //         // 单题分值
      //         singleScore:null,
      //         //总分值
      //         totalScore:0,
      //       },
      //     ]
      //     this.form.rtAssemblyConfs = rtAssemblyConfs
      //   }
      // });
    },
    // 防止后输入题数总量
    totalQuestionschange(){
      let form = this.form
      // 计算难易度合计百分比
      for(let i=0;i<form.rtAssemblyDifficulties.length;i++){
        if(form.totalQuestions !== null && form.totalQuestions!==''){
          this.dataform[0].ratio = (this.dataform[0].num / form.totalQuestions)*100
        }
      }
      // 计算题型占的比例
      for(let i=0;i<form.rtAssemblyConfs.length;i++){
        if(form.totalQuestions !== null && form.totalQuestions!==''){
          if(this.asseform[0].num != null && this.asseform[0].num != ""){
            this.asseform[0].ratio = (this.asseform[0].num / form.totalQuestions)*100
          }
        }
      }
    },
    // 难易度计算
    inputchange(){
      let form = this.form
      this.dataform[0].num = 0
      this.dataform[0].ratio = 0
      // 动态改变试题数量
      for(let i = 0;i<this.form.rtAssemblyDifficulties.length;i++){
        if(form.rtAssemblyDifficulties[i].count !== null && form.rtAssemblyDifficulties[i].count !== ""){
          this.dataform[0].num = form.rtAssemblyDifficulties[i].count*1 + this.dataform[0].num
          if(form.totalQuestions !== null && form.totalQuestions!==''){
            if(this.dataform[0].num !==null && this.dataform[0].num !== ''){
              this.dataform[0].ratio = (this.dataform[0].num / form.totalQuestions)*100
            }else{
              this.dataform[0].num = 0
              this.dataform[0].ratio = (this.dataform[0].num / form.totalQuestions)*100
            }
          }
        }
      }
      // 改变难易度系数
      let num = null
      for(let i = 0;i<this.form.rtAssemblyDifficulties.length;i++){
        if(form.rtAssemblyDifficulties[i].count !== null && form.rtAssemblyDifficulties[i].count !== ""){
          num = num + [(form.rtAssemblyDifficulties[i].difficulty/10)-0.1]*form.rtAssemblyDifficulties[i].count
        }
      }
      // form.difficultyDegree = num/this.dataform[0].num
      num = Math.floor((num/this.form.totalQuestions)*100)
      form.difficultyDegree = num/100
    },
    // 题型数量 计算
    countchange(){
      let form = this.form
      this.asseform[0].num = 0
      this.asseform[0].scoreratio = 0
      for(let i = 0;i<form.rtAssemblyConfs.length;i++){
        // 计算总分数
        if(form.rtAssemblyConfs[i].singleScore != null && form.rtAssemblyConfs[i].singleScore != "" && form.rtAssemblyConfs[i].count != null && form.rtAssemblyConfs[i].count != ""){
          form.rtAssemblyConfs[i].totalScore = form.rtAssemblyConfs[i].singleScore * form.rtAssemblyConfs[i].count
        }
        // 计算合计题数
        if(form.rtAssemblyConfs[i].count != '' && form.rtAssemblyConfs[i].count != null){
          this.asseform[0].num = form.rtAssemblyConfs[i].count*1 + this.asseform[0].num
        }
        // 计算合计百分比
        if(form.totalQuestions != '' && form.totalQuestions != null){
          if(this.asseform[0].num != null && this.asseform[0].num != ""){
            this.asseform[0].ratio = (this.asseform[0].num / form.totalQuestions)*100
          }else{
            this.asseform.num = 0
            this.asseform[0].ratio = (this.asseform[0].num / form.totalQuestions)*100
          }
        }
        // 计算合计总分值
        if(form.rtAssemblyConfs[i].totalScore != '' && form.rtAssemblyConfs[i].totalScore != null){
          this.asseform[0].scoreratio =  form.rtAssemblyConfs[i].totalScore*1 + this.asseform[0].scoreratio
        }
      }
      
    },
    // 单题分值  计算
    singleScorechange(){
       let form = this.form
       this.asseform[0].scoreratio = 0
       for(let i = 0;i<form.rtAssemblyConfs.length;i++){
          // 计算每行的总分值
          if(form.rtAssemblyConfs[i].singleScore != null && form.rtAssemblyConfs[i].singleScore != "" && form.rtAssemblyConfs[i].count != null && form.rtAssemblyConfs[i].count != ""){
            form.rtAssemblyConfs[i].totalScore = form.rtAssemblyConfs[i].singleScore * form.rtAssemblyConfs[i].count
          }
          // 计算合计总分值
          if(form.rtAssemblyConfs[i].totalScore != '' && form.rtAssemblyConfs[i].totalScore != null){
          this.asseform[0].scoreratio =  form.rtAssemblyConfs[i].totalScore*1 + this.asseform[0].scoreratio
        }
      }
    },
    //知识点输入事件
    Knowledgeschange(){
      // 计算知识点总分值
      this.Knowledgesform[0].num = 0
      for(let i=0;i<this.form.rtAssemblyKnowledges.length;i++){
          if(this.form.rtAssemblyKnowledges[i].count != null && this.form.rtAssemblyKnowledges[i].count != ''){
            this.Knowledgesform[0].num = this.form.rtAssemblyKnowledges[i].count * 1 + this.Knowledgesform[0].num
          }
        }
      if(this.form.totalQuestions!=null && this.form.totalQuestions!=''){
        for(let i=0;i<this.form.rtAssemblyKnowledges.length;i++){
          if(this.form.rtAssemblyKnowledges[i].count != null && this.form.rtAssemblyKnowledges[i].count != ''){
            this.Knowledgesform[0].ratio = Math.floor((this.Knowledgesform[0].num/this.form.totalQuestions)*10000)/100
          }
        }
      }
    },
    // 科目下拉
    xialaList() {
      this.loading = true;
      listType().then(response => {
        this.kelist = response.rows;
        this.loading = false;
        console.log(this.kelist,'...........')
      });
    },
    // 地市下拉列表
    areaget() {
      this.loading = true;
      let pid = 0
      areainfo(this.fordishi,pid).then(response => {
        this.arealist = response.rows;
        this.loading = false;
      });
    },
    changearea(value){
        let list = {...this.form}
        list.belongArea = list.shi
        let type = list.belongArea
        // 区市列表查询
        areainfo(list,type).then(response => {
            this.form.belongArea = null //选择省时清空市区list并且改变市区list 
            this.qulist = response.rows;
            this.loading = false;
        });
    },
    /** 查询科目信息列表 */
    getList() {
      this.loading = true;
      listInfo(this.queryParams).then((response) => {
        this.infoList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        subjectId: null,
        name: null,
        clbm: null,
        totalQuestions: null,
        totalScore:null,
        difficultyDegree: null,
        area: null,
        useNearest: null,
        useTimeNearest: null,
        remark: null,
        // status: "0",
        shi:null,
        belongArea:null,
        //难易度
        rtAssemblyDifficulties:[
          {
            difficulty:1,
            diffname:"易",
            proportion:0,
            count:null,
          },
          {
            difficulty:2,
            diffname:"较易",
            proportion:0,
            count:null,
          },
          {
            difficulty:3,
            diffname:"中",
            proportion:0,
            count:null,
          },
          {
            difficulty:4,
            diffname:"较难",
            proportion:0,
            count:null,
          },
          {
            difficulty:5,
            diffname:"难",
            proportion:0,
            count:null,
          },
          {
            difficulty:6,
            diffname:"难",
            proportion:0,
            count:null,
          },
          {
            difficulty:7,
            diffname:"难",
            proportion:0,
            count:null,
          },
          {
            difficulty:8,
            diffname:"难",
            proportion:0,
            count:null,
          },
          {
            difficulty:9,
            diffname:"难",
            proportion:0,
            count:null,
          },
          {
            difficulty:10,
            diffname:"难",
            proportion:0,
            count:null,
          },
          {
            difficulty:11,
            diffname:"难",
            proportion:0,
            count:null,
          },
        ],
        rtAssemblyConfs:[
          {
            questionType:"单选题",
            // 题数
            count:null,
            // 比例
            proportion:0,
            //题型id
            questionTypeId:1,
            // questionTypeModuleId:1,
            singleScore:null,
            totalScore:0,
          },
          {
            questionType:"多选题",
            // 题数
            count:null,
            // 占比
            proportion:0,
            //题型id
            questionTypeId:2,
            // questionTypeModuleId:1,
            // 单题分值
            singleScore:null,
            //总分值
            totalScore:0,
          },
          {
            questionType:"判断题",
            // 题数
            count:null,
            // 占比
            proportion:0,
            //题型id
            questionTypeId:4,
            // questionTypeModuleId:1,
            // 单题分值
            singleScore:null,
            //总分值
            totalScore:0,
          },
          {
            questionType:"案例题",
            // 题数
            count:null,
            // 占比
            proportion:0,
            //题型id
            questionTypeId:5,
            // questionTypeModuleId:1,
            // 单题分值
            singleScore:null,
            //总分值
            totalScore:0,
          },
          {
            questionType:"简答题",
            // 题数
            count:null,
            // 占比
            proportion:0,
            //题型id
            questionTypeId:6,
            // questionTypeModuleId:1,
            // 单题分值
            singleScore:null,
            //总分值
            totalScore:0,
          },
          
        ],//题型
        rtAssemblyKnowledges:[],//知识点

      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.queryParams.examTypeId = null;
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.id);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
    resetlist(){
      this.Knowledgesform = [
        {
          name:"合计",
          num:0,
          ratio:0,
        }
      ]
      this.asseform = [
        {
          name:"合计",
          num:0,
          ratio:0,
          scorenum:null,
          scoreratio:0,
        }
      ]
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.dataform[0].num = 0
      this.dataform[0].ratio = 0
      this.qulist = []
      this.reset();
      this.resetlist()
      this.open = true;
      this.title = "添加考试类型";
      this.$nextTick(() => {
        this.$refs.gain.focus();
      });
    },
    refrtAssemblyConfs(){
      this.xiuConfs=[
          {
            questionType:"单选题",
            // 题数
            count:null,
            // 比例
            proportion:0,
            //题型id
            questionTypeId:1,
            // questionTypeModuleId:1,
            singleScore:null,
            totalScore:0,
          },
          {
            questionType:"多选题",
            // 题数
            count:null,
            // 占比
            proportion:0,
            //题型id
            questionTypeId:2,
            // questionTypeModuleId:1,
            // 单题分值
            singleScore:null,
            //总分值
            totalScore:0,
          },
          {
            questionType:"判断题",
            // 题数
            count:null,
            // 占比
            proportion:0,
            //题型id
            questionTypeId:4,
            // questionTypeModuleId:1,
            // 单题分值
            singleScore:null,
            //总分值
            totalScore:0,
          },
          {
            questionType:"案例题",
            // 题数
            count:null,
            // 占比
            proportion:0,
            //题型id
            questionTypeId:5,
            // questionTypeModuleId:1,
            // 单题分值
            singleScore:null,
            //总分值
            totalScore:0,
          },
          {
            questionType:"简答题",
            // 题数
            count:null,
            // 占比
            proportion:0,
            //题型id
            questionTypeId:6,
            // questionTypeModuleId:1,
            // 单题分值
            singleScore:null,
            //总分值
            totalScore:0,
          },
          
        ]//题型
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.refrtAssemblyConfs()//重置修改时的题型模块的基础数据
      // console.log(this.form.rtAssemblyConfs,'11111')
      // 防止修改后数据错误
      for(var i=0;i<this.xiuDifficult.length;i++){
        this.xiuDifficult[i].count = null
      }
      // for(var i=0;i<this.xiuConfs.length;i++){
      //   this.xiuConfs[i].count = null
      // }
      // this.xiuDifficult = []
      const id = row.id || this.ids;
      getInfo(id).then((response) => {
        this.form = response.data;
      // console.log(this.form.rtAssemblyConfs,'11111')
        this.open = true;
        this.title = "修改考试类型";
        let form = this.form
        this.dataform[0].num = 0
        this.asseform[0].num = 0
        this.asseform[0].scoreratio = 0
        this.Knowledgesform[0].num = 0
        this.Knowledgesform[0].scoreratio = 0
        // 补充没有填的列表   难易度
        for(var i=0;i<this.xiuDifficult.length;i++){
          for(let j = 0;j<this.form.rtAssemblyDifficulties.length;j++){
            if(this.xiuDifficult[i].difficulty == this.form.rtAssemblyDifficulties[j].difficulty){
              this.xiuDifficult[i].count = this.form.rtAssemblyDifficulties[j].count
            }
          }
        }
        this.form.rtAssemblyDifficulties = this.xiuDifficult
        // 动态改变试题数量   难易度
        for(let i = 0;i<form.rtAssemblyDifficulties.length;i++){
          if(form.rtAssemblyDifficulties[i].count !== null && form.rtAssemblyDifficulties[i].count !== ""){
            this.dataform[0].num = form.rtAssemblyDifficulties[i].count*1 + this.dataform[0].num

            this.dataform[0].ratio = (this.dataform[0].num / form.totalQuestions)*100
            
          }            
        }
        // 补充没有填的列表   题型比例

        for(var i=0;i<this.xiuConfs.length;i++){
          for(let j = 0;j<this.form.rtAssemblyConfs.length;j++){
            if(this.xiuConfs[i].questionTypeId == this.form.rtAssemblyConfs[j].questionTypeId){
              this.xiuConfs[i].count = this.form.rtAssemblyConfs[j].count
              this.xiuConfs[i].singleScore = this.form.rtAssemblyConfs[j].singleScore
            }
          }
        }
        this.form.rtAssemblyConfs = this.xiuConfs
        // 合计反显   题型比例
        for(let i = 0;i<form.rtAssemblyConfs.length;i++){
          if(form.rtAssemblyConfs[i].count !== null && form.rtAssemblyConfs[i].count !== ""){
            // 总分值
            form.rtAssemblyConfs[i].totalScore = form.rtAssemblyConfs[i].count * form.rtAssemblyConfs[i].singleScore

            this.asseform[0].num = form.rtAssemblyConfs[i].count*1 + this.asseform[0].num

            this.asseform[0].ratio = (this.asseform[0].num / form.totalQuestions)*100

            this.asseform[0].scoreratio =  form.rtAssemblyConfs[i].totalScore*1 + this.asseform[0].scoreratio
          }
        }
        // 反显是请求知识点
        this.inidlist.subjectId = this.form.subjectId
        infoList(this.inidlist,this.inidlist.subjectId,this.inidlist.type=3).then(response => {
          this.zhilist = response.rows;
          console.log(this.zhilist,'this.zhilist')
          console.log(this.zhilist.length,'this.zhilist.le.length.lengthngth')
          console.log(response.rows,'response.rows')
          this.loading = false;
          if(this.form.rtAssemblyKnowledges.length!=0){
            for(let i=0;i<this.zhilist.length;i++){
              this.zhilist[i].knowledgeId = this.zhilist[i].id
              for(let j=0;j<this.form.rtAssemblyKnowledges.length;j++){
                if(this.zhilist[i].id == this.form.rtAssemblyKnowledges[j].knowledgeId){
                  this.zhilist[i].count = this.form.rtAssemblyKnowledges[j].count
                }else {
                  if(!this.zhilist[i].count){
                    this.zhilist[i].count = ""
                  }
                }
              }
            }
          }else{
            for(let i=0;i<this.zhilist.length;i++){
              this.zhilist[i].knowledgeId = this.zhilist[i].id
              this.zhilist[i].count = ""
            }
          }
          // console.log(this.zhilist,'this.zhilist')
          this.form.rtAssemblyKnowledges=this.zhilist
          // console.log(this.form.rtAssemblyKnowledges,'*************')
        });
        // 计算知识点的合计
        for(let i=0;i<this.form.rtAssemblyKnowledges.length;i++){
          if(this.form.rtAssemblyKnowledges[i].count !== "" && this.form.rtAssemblyKnowledges[i].count){
            this.Knowledgesform[0].num = this.form.rtAssemblyKnowledges[i].count*1 + this.Knowledgesform[0].num
          }
          this.Knowledgesform[0].ratio = Math.floor((this.Knowledgesform[0].num/this.form.totalQuestions)*10000)/100
        }
        // 地市反显
        if(this.form.belongArea != null){
          areainfo(this.fordishi,0).then(response => {
            this.arealist = response.rows;
            this.loading = false;
          });
           // 存市的id
          let id = this.form.belongArea
          // 存省的id
          let pid = null
          //请求全部的省和市
          areasinfo().then(response => {
            let list = []
            list = response.rows;
            // 遍历id跟返回值一样的id
            for(let i=0;i<list.length;i++){
              if(list[i].id == id){
                pid = list[i].pid
                this.form.shi = pid
              }
            }
          }).then(()=>{
            areainfo(this.form,pid).then(response => {
              this.qulist = response.rows;
            });
          });
        }else{
          areainfo(this.fordishi,0).then(response => {
            this.arealist = response.rows;
            this.loading = false;
          });
          this.qulist = []
        }
      });
      
    },
    // 计算 没有填写的多余数据不传
    submitFormchange(){
      let nlist = []
      let tlist = []
      let zlist = []
      if(this.form.subjectId!=null && this.form.name!=null && this.form.clbm!=null && this.form.totalQuestions!=null && this.form.totalScore!=null){

      // 提交计算难易度各题比例
      for(let i=0;i<this.form.rtAssemblyDifficulties.length;i++){
        this.form.rtAssemblyDifficulties[i].proportion = this.form.rtAssemblyDifficulties[i].count * 1 / this.form.totalQuestions
        if(this.form.rtAssemblyDifficulties[i].count != null && this.form.rtAssemblyDifficulties[i].count !== ""){
          nlist.push(this.form.rtAssemblyDifficulties[i])
        }
      }
      // 提交计算模块各题型比例
      for(let i=0;i<this.form.rtAssemblyConfs.length;i++){
        this.form.rtAssemblyConfs[i].totalQuestions = this.form.rtAssemblyConfs[i].count * 1 * this.form.singleScore
        if(this.form.rtAssemblyConfs[i].count != null && this.form.rtAssemblyConfs[i].count !== ""){
          tlist.push(this.form.rtAssemblyConfs[i])
        }
      }
      // 提交计算各知识点比例
      for(let i=0;i<this.form.rtAssemblyKnowledges.length;i++){
        this.form.rtAssemblyKnowledges[i].smartProportion = this.form.rtAssemblyKnowledges[i].count * 1 / this.form.totalQuestions
        
        if(this.form.rtAssemblyKnowledges[i].count != null && this.form.rtAssemblyKnowledges[i].count !== ""){
          zlist.push(this.form.rtAssemblyKnowledges[i])
        }
      }
      // 提交之前赋值不要为空的数组
      // 难易度各题比例数组
      this.form.rtAssemblyDifficulties = nlist
      // 模块各题型比例数组
      this.form.rtAssemblyConfs = tlist
      // 知识点比例
      this.form.rtAssemblyKnowledges = zlist
      }
      console.log(this.form,'执行方法完毕')
    },
    // 数组全为默认值的时候传空
    /** 提交按钮 */
    submitForm() {
      // 难易度
      let Difficultiesstutas = true
      for(var i=0;i<this.form.rtAssemblyDifficulties.length;i++){
        if(this.form.rtAssemblyDifficulties[i].count !== "" && this.form.rtAssemblyDifficulties[i].count !== null){
          Difficultiesstutas = false
        }
      }
      // 题型
      let Confstutas = true
      for(var i=0;i<this.form.rtAssemblyConfs.length;i++){
        if(this.form.rtAssemblyConfs[i].count !== "" && this.form.rtAssemblyConfs[i].count !== null){
          Confstutas = false
        }
      }
      // 知识点
      let Knowledgesstutas = true
      for(var i=0;i<this.form.rtAssemblyKnowledges.length;i++){
        if(this.form.rtAssemblyKnowledges[i].count !== "" && this.form.rtAssemblyKnowledges[i].count !== null){
          Knowledgesstutas = false
        }
      }
      // ****************************************************
      let rules = 0
      let totalQuestions = this.form.totalQuestions*1
      let totalScore = this.form.totalScore*1
      // 难易度
      if(!Difficultiesstutas){
        if(this.dataform[0].num != totalQuestions){
        // 判断 难易度试题数量不能超过或者小于总数量
          rules = 1
        }
      }
      // 题型
      if(!Confstutas){
        if(this.asseform[0].num != totalQuestions){
        // 判断 题型数量不能超过总数量
          rules = 2
        }else if(this.asseform[0].scoreratio != totalScore){
        // 判断 分值不能超过总分值
          rules = 3
        }
      }else{
          rules = 101
      }
      // 知识点
      if(!Knowledgesstutas){
        if(this.Knowledgesform[0].num != totalQuestions){
        // 判断 知识点数量不能超过总数量
          rules = 4
        }
      }
      if(this.form.shi){
        if(this.form.belongArea){

        }else{
          rules = 666
        }
      }
      console.log(this.form,'没过校验之前')
      this.$refs["form"].validate((valid) => {
        if (valid) {
          if (this.form.id != null) {
            if(rules == 0){
              this.$confirm("是否确认修改数据？", "提示", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
              }).then(() => {
                this.submitFormchange()
                if(Difficultiesstutas){// 难易度
                  this.form.rtAssemblyDifficulties = []
                }else if(Confstutas){// 题型
                  this.form.rtAssemblyConfs = []
                }else if(Knowledgesstutas){// 知识点
                  this.form.rtAssemblyKnowledges = []
                }
                  updateInfo(this.form).then((response) => {
                    this.msgSuccess("修改成功");
                    this.open = false;
                    this.getList();
                  });
                })
                .catch(() => {});
            }else if(rules == 1){
              this.$confirm('难易度试题数量不能超过，或者小于总数量', "提示", {
                  confirmButtonText: "确定",
                  cancelButtonText: "取消",
                  type: "warning"
              }).catch(() => {});
            }else if(rules == 2){
              this.$confirm('题型数量不能超过，或者小于总数量', "提示", {
                  confirmButtonText: "确定",
                  cancelButtonText: "取消",
                  type: "warning"
              }).catch(() => {});
            }else if(rules == 3){
              this.$confirm('分值不能超过，或者小于总分值', "提示", {
                  confirmButtonText: "确定",
                  cancelButtonText: "取消",
                  type: "warning"
              }).catch(() => {});
            }else if(rules == 4){
              this.$confirm('知识点数量不能超过，或者小于总数量', "提示", {
                  confirmButtonText: "确定",
                  cancelButtonText: "取消",
                  type: "warning"
              }).catch(() => {});
            }else if(rules == 666){
              this.$confirm('地市请填写完整', "提示", {
                  confirmButtonText: "确定",
                  cancelButtonText: "取消",
                  type: "warning"
              }).catch(() => {});
            }else if(rules == 101){
              this.$confirm('题型比例必须填写', "提示", {
                  confirmButtonText: "确定",
                  cancelButtonText: "取消",
                  type: "warning"
              }).catch(() => {});
            }
          } else {
            if(rules == 0){
              console.log(this.form,'方法之后')
              this.$confirm("是否确认新增数据？", "提示", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
              }).then(() => {
                this.submitFormchange()
                if(Difficultiesstutas){// 难易度
                  this.form.rtAssemblyDifficulties = []
                }else if(Confstutas){// 题型
                  this.form.rtAssemblyConfs = []
                }else if(Knowledgesstutas){// 知识点
                  this.form.rtAssemblyKnowledges = []
                }
                addInfo(this.form).then((response) => {
                  this.msgSuccess("新增成功");
                  this.open = false;
                  this.getList();
                });
              }).catch(() => {});
            }else if(rules == 1){
              this.$confirm('难易度试题数量不能超过，或者小于总数量', "提示", {
                  confirmButtonText: "确定",
                  cancelButtonText: "取消",
                  type: "warning"
              }).catch(() => {});
            }else if(rules == 2){
              this.$confirm('题型数量不能超过，或者小于总数量', "提示", {
                  confirmButtonText: "确定",
                  cancelButtonText: "取消",
                  type: "warning"
              }).catch(() => {});
            }else if(rules == 3){
              this.$confirm('分值不能超过，或者小于总分值', "提示", {
                  confirmButtonText: "确定",
                  cancelButtonText: "取消",
                  type: "warning"
              }).catch(() => {});
            }else if(rules == 4){
              this.$confirm('知识点数量不能超过，或者小于总数量', "提示", {
                  confirmButtonText: "确定",
                  cancelButtonText: "取消",
                  type: "warning"
              }).catch(() => {});
            }else if(rules == 666){
              this.$confirm('地市请填写完整', "提示", {
                  confirmButtonText: "确定",
                  cancelButtonText: "取消",
                  type: "warning"
              }).catch(() => {});
            }else if(rules == 101){
              this.$confirm('题型比例必须填写', "提示", {
                  confirmButtonText: "确定",
                  cancelButtonText: "取消",
                  type: "warning"
              }).catch(() => {});
            }
            
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$confirm("是否确认删除当前数据?", "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(function () {
          return delInfo(ids);
        })
        .then(() => {
          this.getList();
          this.msgSuccess("删除成功");
        })
        .catch(() => {});
    },
  },
};
</script>
